<?php
require_once ('config.php');
$lexadded = $_SESSION['lextimedate'];
$userid = $_SESSION['userid'];
$random = rand(1,5);

function getLexid($userid) {
	$con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die("Could not execute query");
	$query = "SELECT lexadded FROM lex WHERE userid = $userid AND $lextitle = $lexadded; ";
	$result = mysqli_query($con, $query) or die("Could not SELECT lexid FROM lex WHERE userid = $userid AND lexadded = ");
	while ($row = mysqli_fetch_array($result)) {
	
	}

}

function getGReflection($reflectionNo, $choicebank) {
	$con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die("Could not execute query");
	$reflectionNo = "ref$reflectionNo";
	$query = "SELECT * FROM $reflectionNo WHERE choicebank = $choicebank ORDER BY RAND()";
	$result = mysqli_query($con, $query) or die("Could not get the required reflection guidance");
	while ($row = mysqli_fetch_array($result)) {
	echo("<option value = '" . $row['choicetext'] . "'>" . $row['choicetext'] . "</option>");
	}

}

function getGOutcome($outcomeNo, $choicebank) {
	$con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die("Could not execute query");
	$outcomeNo = "outcome$outcomeNo";
	$query = "SELECT * FROM $outcomeNo WHERE choicebank = $choicebank ORDER BY RAND()";
	$result = mysqli_query($con, $query) or die("Could not get the required outcome guidance");
	while ($row = mysqli_fetch_array($result)) {
	echo("<option value = '" . $row['choicetext'] . "'>" . $row['choicetext'] . "</option>");
	}

}


function getGRstarter($refid) {
	$con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die("Could not execute query");
	$query = "SELECT * FROM reflectionStarter";
	$result = mysqli_query($con, $query) or die("Could not get the required reflection starter text");
	while ($row = mysqli_fetch_array($result)) {
	echo "<span>" . $row['startertext'] . "</span>";
	}
}


// function getGRVerbs($random) {
	// $con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die("Could not execute query");
	// $query = "SELECT * FROM reflectionVerbs WHERE verbid= $random";
	// $result = mysqli_query($con, $query) or die("Could not get the required reflection verb");
	// while ($row = mysqli_fetch_array($result)) {
	// echo("<option value = '" . $row['verbid'] . "'>" . $row['verbtext'] . "</option>");
	// }
// }
// ?>
				
<script>
        function goreflect() {
        window.location = "http://localhost/eportfolio/reflection.php";
        };
        


function reflectionEntry() {
	alert(document.getElementById("reflectionEntry").innerHTML);
}
</script> 
